package com.study.demo.injector.module;

import android.content.Context;

import com.study.demo.api.forum.ForumApi;
import com.study.demo.api.game.GameApi;
import com.study.demo.api.login.CookieApi;
import com.study.demo.components.retrofit.RequestHelper;
import com.study.demo.components.storage.UserStorage;

import javax.inject.Named;
import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;
import okhttp3.OkHttpClient;

/**
 * Created by shangsong on 17-3-9.
 */
@Module
public class ApiModule {
    @Provides
    @Singleton
    public ForumApi provideForumApi(RequestHelper requestHelper, UserStorage userStorage,
                                    @Named("api") OkHttpClient okHttpClient, Context context) {
        return new ForumApi(requestHelper, userStorage, okHttpClient, context);
    }

    @Provides
    @Singleton
    public GameApi provideGameApi(RequestHelper requestHelper,
                                  @Named("api") OkHttpClient okHttpClient) {
        return new GameApi(requestHelper, okHttpClient);
    }

    @Provides
    @Singleton
    public CookieApi providesCookieApi(@Named("api") OkHttpClient okHttpClient) {
        return new CookieApi(okHttpClient);
    }
}
